package com.weixin.paleituo.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.weixin.paleituo.R;
import com.weixin.paleituo.base.BaseRecycleAdapter;
import com.weixin.paleituo.bean.LotterBuyHouseBean;
import com.weixin.paleituo.eventbus.LotterBuyHouseEvent;
import com.weixin.paleituo.help.RecycleViewHolder;
import com.weixin.paleituo.util.LogUtils;

import org.greenrobot.eventbus.EventBus;

import java.util.List;

/**
 * Author yichao
 * Time  2018/2/26 11:20
 * Dest 摇号买房
 */

public class LotterBuyHouseAdapter extends BaseRecycleAdapter<LotterBuyHouseBean> {

    private String TAG=LotterBuyHouseAdapter.class.getSimpleName();

    public void setCurrentPosition(int currentPosition) {
        this.currentPosition = currentPosition;
    }

    private int currentPosition=0;


    public LotterBuyHouseAdapter(Context context, List<LotterBuyHouseBean> datas) {
        super(context, datas, R.layout.item_lotter_buy_house_layout);
    }

    @Override
    protected void setData(RecycleViewHolder holder, LotterBuyHouseBean lotterBuyHouseBean, final int position) {


        TextView tvRoomName= holder.getItemView(R.id.tv_room_name_lotter_buy_house_layout);
        tvRoomName.setText(lotterBuyHouseBean.getFullName()+"");

        holder.mItemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              //  ToastUtils.makeText(position);
                LogUtils.i(TAG,"选择摇号的房子");
                EventBus.getDefault().post(new LotterBuyHouseEvent(position));
            }
        });

    }
}
